﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Com.Framework;
using Com.Framework.File;
using Com.Framework.Data;
using Com.Library.DB.Recruit;
using Com.Web.coffinegurunaru.AppLogic.Page;

namespace Com.Web.coffinegurunaru.aboutus
{
	public partial class recruit_write : WebPage
	{
		protected void Page_Load(object sender, EventArgs e)
		{
			this.LeftMenuType = 4;

			if (this.IsPostBack)
			{
				string Name = string.Empty;
				string PersonalNo1 = string.Empty;
				string PersonalNo2 = string.Empty;
				string Phone1 = string.Empty;
				string Phone2 = string.Empty;
				string Phone3 = string.Empty;
				string Email1 = string.Empty;
				string Email2 = string.Empty;
				string PostNo1 = string.Empty;
				string PostNo2 = string.Empty;
				string Address = string.Empty;
				string HopeStore = string.Empty;
				string JobTime = string.Empty;
				string Academic = string.Empty;
				string Career = string.Empty;
				string License = string.Empty;
				string FileURL = string.Empty;

				Name = Request.Form["Name"].Parse(string.Empty);
				PersonalNo1 = Request.Form["PersonalNo1"].Parse(string.Empty);
				PersonalNo2 = Request.Form["PersonalNo2"].Parse(string.Empty);
				Phone1 = Request.Form["Phone1"].Parse(string.Empty);
				Phone2 = Request.Form["Phone2"].Parse(string.Empty);
				Phone3 = Request.Form["Phone3"].Parse(string.Empty);
				Email1 = Request.Form["Email1"].Parse(string.Empty);
				Email2 = Request.Form["Email2"].Parse(string.Empty);
				PostNo1 = Request.Form["PostNo1"].Parse(string.Empty);
				PostNo2 = Request.Form["PostNo2"].Parse(string.Empty);
				Address = Request.Form["Address"].Parse(string.Empty);
				HopeStore = Request.Form["HopeStore"].Parse(string.Empty);
				JobTime = Request.Form["JobTime"].Parse(string.Empty);
				Academic = Request.Form["Academic"].Parse(string.Empty);
				Career = Request.Form["Career"].Parse(string.Empty);
				License = Request.Form["License"].Parse(string.Empty);

				string PersonalNo = PersonalNo1 + "-" + PersonalNo2;
				string PhoneNo = Phone1 + "-" + Phone2 + "-" + Phone3;
				string Email = Email1 + "@" + Email2;
				string PostNo = PostNo1 + "-" + PostNo2;

				if (Request.Files.Count == 1)
				{
					FileURL = FileManager.UploadFor(Request.Files[0], FileType.Recruit);
				}

				RecruitModel.Create(
					Name, PersonalNo, PhoneNo, Email, PostNo, Address, HopeStore, Convert.ToByte(JobTime),
					Academic, Career, License, FileURL);

			}
		}
	}
}
